'use strict';

describe('test new rules directive', function() {
  var $compile, $scope;
  var element;

  beforeEach(module('fbdApp.ruleModule'));
  beforeEach(module('templates'));

  beforeEach(inject(function(_$compile_, _$rootScope_) {
    $compile = _$compile_;
    $scope = _$rootScope_.$new();
    element = $compile("<new-rule></new-rule>")($scope);
    $scope.$digest();
  }));

  it('default value and attributes', function(done) {
    expect(element.find('ng-form').attr('name')).toBe('newRules');
    // expect(element.find('h4').text()).toBe('添加规则');
    expect(element.find('input').length).toBe(3);
    expect(element.find('select').length).toBe(2);
    expect(element.find('textarea').length).toBe(2);
    expect(element.find('button').length).toBe(2);
    // expect()
    // expect(element.querySelector('.btn').length).toBe(3);

    // expect(element.find('form').hasClass('ng-invalid')).toBe(true);
    // expect(element.find('select').hasClass('ng-invalid-required')).toBe(
    //   true);
    // expect(element.find('textarea').hasClass('ng-invalid-required')).toBe(
    //   true);
    return done();
  });


});
